In [ ]:
import h2o
from h2o.estimators.deeplearning import H2ODeepLearningEstimator

In [ ]:
h2o.init(nthreads=-1, max_mem_size=8)

In [ ]:
datasets = "https://raw.githubusercontent.com/DarrenCook/h2o/bk/datasets/"

In [ ]:
data = h2o.import_file(datasets + "iris_wheader.csv")

In [ ]:
y = "class"

In [ ]:
x = data.names

In [ ]:
x.remove(y)

In [ ]:
train, test = data.split_frame([0.8])

In [ ]:
m = H2ODeepLearningEstimator()

In [ ]:
m.train(x, y, train)

In [ ]:
p = m.predict(test)

In [ ]:
p.as_data_frame()

In [ ]:
(p["predict"] == test["class"]).mean()

In [ ]:
p["predict"].cbind(test["class"]).as_data_frame()

Import data


In [ ]:
df = h2o.import_file("hdfs://namenode/user/path/to/my.csv")
df = h2o.import_file("s3://<AWS_ACCESS_KEY>:<AWS_SECRET_KEY>@mybucket/my.csv")
df = h2o.import_file("https://s3.amazonaws.com/mybucket/my.csv")
df = h2o.import_file("/path/to/my.csv")

Import from database


In [ ]:
h2o.import_sql_table()
h2o.import_sql_select()

Importing and manipulating data


In [ ]:
datasets = "https://raw.githubusercontent.com/DarrenCook/h2o/bk/datasets/"
data = h2o.import_file(datasets + "iris_wheader.csv")
data.frame_id  #iris_wheader.hex

data = data[:,1:] #Drop column 0. Keep column 1 onwards.
data.frame_id  #py_2_sid_88fe

data = h2o.assign(data, "iris")
data.frame_id  #iris

h2o.ls()  #iris and iris_wheader.hex, no py_2_sid_88fe
h2o.remove("iris_wheader.hex")
h2o.ls()  #Just lists iris

In [ ]: